//
//  MotionBlur.cpp
//  Ray Tracer
//
//  Created by Kaila, Ashish on 3/21/13.
//  Copyright (c) 2013 Kaila, Ashish. All rights reserved.
//

#include "MotionBlur.h"
#include "raytracer.h"
#include <stdlib.h>

MotionBlur::MotionBlur(SceneDagNode* sceneObject,
                       Vector3D motionVector)
: _sceneObject(sceneObject),
  _motionVector(motionVector)
{
}

void MotionBlur::startMotionBlur()
{
    double eps = (double)rand() / (double)RAND_MAX;
    _transformation = eps * (_motionVector);
    _sceneObject->obj->translate(_transformation);
}

void MotionBlur::endMotionBlur()
{
    _sceneObject->obj->translate(Vector3D(-1 * _transformation[0], -1 * _transformation[1], -1 * _transformation[2]));
}